//
//  XWCommon.h
//  XWKitDemo
//
//  Created by xiaowuxiaowu on 16/4/17.
//  Copyright © 2016年 xiaowuxiaowu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Photos/Photos.h>
#import "AppDelegate.h"
@interface XWCommon : NSObject

+(AppDelegate*)shareAppDelegate;
/**
 *  正则判断手机号码地址格式
 *
 *
 *
 *   YES & NO
 */
BOOL xw_isMobileNumber(NSString *mobileNum);

/**
 *  获取storyBoard上的vc
 *
 *  @param identifier identifier
 *  @param title      哪个storyBoard
 *
 *  @return vc
 */
id xw_getController(NSString *identifier,NSString *title);
id un_getController(Class view);

/**
 *  验证邮箱
 *
 *  @param email 字符串
 *
 *  @return 返回布尔值
 */

BOOL xw_isValidateEmail(NSString *email);

/**
 *  验证md5
 *
 *
 *  @return md5 之后的值
 */

NSString *xw_md5(NSString *inPutText);
/**
 *  验证UTF8转码
 *
 *
 *  @return UTF8转码之后的值
 */
NSString* changeToUTF8(NSString *str);

/**
 *  身份证验证
 *
 *  @param sPaperId sPaperId
 *
 *  @return YES & NO
 */
BOOL xw_chk18PaperId(NSString *sPaperId);


/**
 *  空值验证
 *
 *  @param obj obj description
 *
 *  @return 如果是nil 那么返回 @""
 */
NSString *xw_getNULLString(NSObject*obj);

id xw_getNULLArray(NSObject*obj);

/*-------------------------- 不
  -----------------------------常
   ------------------------------用
     ------------------------------*/

/**
 *  获取视频缩略图
 *
 *
 *
 *  @return image
 */
+(UIImage *)xw_getVideoImage:(id )videoURL;


/**
 *  DES加密 ：用CCCrypt函数加密一下，然后用base64编码
 *
 *
 *  
 *
 *  @return NSString
 */
+ (NSString *)encrypt:(NSString *)sText key:(NSString *)key;




/**
 *  拨打电话
 *
 *  @param phone 手机号码
 *  @param view  显示在哪个View
 */
+(void)getPhoneNuber:(NSString *)phone view:(UIView *)view;


+(void)getPhoneSheet:(void (^)(BOOL isCancel,NSInteger row))block;
/**
 *  标红*
 *
 *  @param text 传参
 *
 *  @return NSMutableAttributedString
 */
+(NSMutableAttributedString *)LabelAttributedtext:(NSString*)text;

//登录
BOOL xw_getLogin();



+(UIViewController *)getViewController;
+(void)setViewController:(UIViewController *)viewController;


+(NSString *)getAstroWithMonth:(NSInteger)m day:(NSInteger)d;


typedef void(^Result)(NSData *fileData, NSString *fileName);

typedef void(^ResultPath)(NSString *filePath, NSString *fileName);
+ (void)getImageFromPHAsset:(PHAsset *)asset Complete:(ResultPath)result;
+ (void)getImageVideoPathFromPHAsset:(PHAsset *)asset Complete:(ResultPath)result;


+(void)saveAsset:(AVAsset *)asset orUrl:(NSURL *)url export:(NSString *)exportPath chooseVideoAlbumBlock:(void(^)(UIImage *image,NSString *path))block;




+(UIViewController *)getViewController;
+(void)setViewController:(UIViewController *)viewController;

@end
